<template tag="以下文档内容为hycli自动生成">
  <div style="height: 100%">
    <div style="margin:0.8rem;"><h5 style="display:inline">产品问题</h5><span style="margin-left: 0.5rem; color:#999"> 记录原型设计,UI设计中的问题</span>
        <ddmenu :menuList="lob_idList" @valueChanged="onlob_idChange" v-model="form_aaaod.lob_id" menuType="my_business_line" ></ddmenu>
    </div>
    <hr style="margin-top:0;color:#999"/>
<div class="query">
    
    <el-form :model="form_aaaod" inline >
        <!-- 日期控件个数： 1 -->
        <el-form-item>
            <!--多日期范围控件 -->
            <el-select v-model="form_aaaod.single_date_range_name" filterable placeholder="日期类型" style="width:120px;" class="prepend">
                <el-option
                v-for="item in multiQueryDateRange"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
        </el-select>
            <el-date-picker :shortcuts="shortcuts" style="width: 200px" v-model="form_aaaod.single_date_range_value" type="daterange" start-placeholder="开始日期"
                end-placeholder="结束日期" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
        </el-form-item>
        <!--状态 下拉控件 -->
        <el-form-item>
            <el-select  v-model="form_aaaod.status" style="width: 100px" filterable clearable placeholder="状态">
                <el-option v-for="item in statusList" :key="item.value" :label="item.name" :value="item.value" />
            </el-select>
        </el-form-item>
        <!--需求 下拉控件多选 -->
        <el-form-item>
            <el-select v-model="form_aaaod.prod_id" filterable clearable multiple collapse-tags  style="width: 140px"
            collapse-tags-tooltip placeholder="需求">
                <el-option v-for="item in prod_idList" :key="item.value" :label="item.name" :value="item.value" />
            </el-select>
        </el-form-item>
        <!--问题分类 下拉控件多选 -->
        <el-form-item>
            <el-select v-model="form_aaaod.problem_category" filterable clearable multiple collapse-tags  style="width: 140px"
            collapse-tags-tooltip placeholder="问题分类">
                <el-option v-for="item in problem_categoryList" :key="item.value" :label="item.name" :value="item.value" />
            </el-select>
        </el-form-item>
        <!-- 控件个数：[{"index":85,"raw":"title","name":"title","cname":"Title","type":{"raw":"varchar2(128)","name":"varchar2","len":128,"dlen":0},"defValue":"","allowNull":false,"constraints":["q","c","u","l","le","v","rows(1)","lw(200)","@title"],"desc":{"raw":"标题","name":"标题"}} {"index":88,"raw":"description","name":"description","cname":"Description","type":{"raw":"text","name":"text","len":0,"dlen":0},"defValue":"","allowNull":false,"constraints":["q","c","u","le","v","rows(8)","tp(rtext,c-u)"],"desc":{"raw":"问题说明","name":"问题说明"}}] -->
         <el-form-item>
            <el-input clearable style="width: 180px" v-model="form_aaaod.single_text_value" maxlength="32"
                placeholder="关键字" >
                <template #prepend>
                    <el-select v-model="form_aaaod.single_text_name" placeholder="查询类型" style="width:84px;">
                        <el-option
                        v-for="item in multiQueryText"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      />
                      </el-select>
                  </template>
            </el-input>
        </el-form-item>

        <span class="ddl">
        </span>
        <el-form-item>
            <el-space wrap>
                <el-button type="primary" icon="Search" @click="onQuery(true)">查询</el-button>
            </el-space>
        </el-form-item>
        
        <div class="blist">
            <el-button-group>
                <el-button :type="$js.page.tagColor(0)"
                
                 icon="Plus"  @click="show_cmpnt_aaaoh">添加问题收集</el-button>
                <el-button :type="$js.page.tagColor(1)"
                 :disabled="bcheck.length==0" 
                 @click="show_cmpnt_aaaoi">已解决</el-button>
                <el-button :type="$js.page.tagColor(2)"
                 :disabled="bcheck.length==0" 
                 @click="show_cmpnt_aaaoj">完成</el-button>
            </el-button-group>
        </div>

        <!-- xtabs -->
        

    </el-form>
</div>
<div>
   <aaaoh ref="cmpnt_aaaoh" @onsaved="onQuery"></aaaoh>
   <aaaof ref="cmpnt_aaaof" @onsaved="onQuery"></aaaof>
   <aaaoe ref="cmpnt_aaaoe" @onsaved="onQuery"></aaaoe>
   <aaaoi ref="cmpnt_aaaoi" @onsaved="onQuery"></aaaoi>
   <aaaoj ref="cmpnt_aaaoj" @onsaved="onQuery"></aaaoj>
   <aaaog ref="cmpnt_aaaog" @onsaved="onQuery"></aaaog>
</div>
<div class="list">
    <el-table :data="dataList_aaaod"
    @selection-change="handleSelectionChange" 
    v-loading="conf.loading" stripe  style="width: 100%;height:calc(100vh - 160px)"
         empty-text="无数据">le
<el-table-column width="24px" type="expand">
    <template #default="view">
        <el-row :gutter="24">
            <el-col :span="5" class="text-right" style="min-height:26px">编号:</el-col>
            <el-col :span="7" v-text="view.row.le_id" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">标题:</el-col>
            <el-col :span="7" v-html="view.row.le_title||'-'" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">需求:</el-col>
            <el-col :span="7" v-text="view.row.prod_id_label" style="min-height:26px"
              ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">问题分类:</el-col>
            <el-col :span="7" v-text="view.row.problem_category_label" style="min-height:26px"
              ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">问题说明:</el-col>
            <el-col :span="7" v-text="view.row.le_description" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">图片:</el-col>
            <el-col :span="7" style="min-height:26px">
                <el-image style="width:48px" :src="view.row.le_description_urls" preview-teleported :fit="contain"  :preview-src-list="[view.row.le_description_urls]">
                    <template #error>
                        <div class="image-slot">
                          <el-icon><icon-picture /></el-icon>
                        </div>
                      </template>
                </el-image>
            </el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">解决方案:</el-col>
            <el-col :span="7" v-text="view.row.le_solution" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">解决人:</el-col>
            <el-col :span="7" v-text="view.row.resolver_label" style="min-height:26px"
              ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">状态:</el-col>
            <el-col :span="7" v-text="view.row.status_label" style="min-height:26px"
              :class="$js.page.colorful(view.row.status,'status')" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">创建人:</el-col>
            <el-col :span="7" v-text="view.row.creator_label" style="min-height:26px"
              ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">创建时间:</el-col>
            <el-col :span="7" v-text="view.row.le_create_time" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">业务线:</el-col>
            <el-col :span="7" v-text="view.row.lob_id_label" style="min-height:26px"
              ></el-col>
        </el-row>
    </template>
</el-table-column>
          <el-table-column type="selection" width="32" /> 
        	<!--id text -->
        <el-table-column  show-overflow-tooltip    align="center" label="编号" >
            <template #default="scope">
                  <span>{{ scope.row.id||'-' }}</span>
              </template>
        </el-table-column>
        	<!--title text -->
        <el-table-column  show-overflow-tooltip   min-width="200"   align="center" label="标题" >
            <template #default="scope">
                  <span>{{ scope.row.title||'-' }}</span>
              </template>
        </el-table-column>
        	<!--prod_id select -->
        <el-table-column    min-width="160"   prop="prod_id" align="center" label="需求">
            <template #default="scope">
                <span 
                    v-text="scope.row.prod_id_label"></span>
            </template>
        </el-table-column>
        	<!--problem_category tag -->
        <el-table-column    prop="problem_category" align="center" label="问题分类">
            <template #default="scope">
                <el-tag :type="$js.page.tagColor(scope.row.problem_category,'problem_category')" round v-text="scope.row.problem_category_label"  ></el-tag>
            </template>
        </el-table-column>
        	<!--description_urls img -->
        <el-table-column   align="center" label="图片">
            <template #default="scope">
                <el-image v-for="v in scope.row.description_urls.split(',')" :key="v" style="width:64px"  :src="v" preview-teleported :fit="contain"  :preview-src-list="scope.row.description_urls.split(',')"
               >
                    <template #error>
                        <div class="image-slot">
                            <el-icon>
                                <icon-picture />
                            </el-icon>
                        </div>
                    </template>
                </el-image>
            </template>
        </el-table-column>
        	<!--resolver multiselect -->
        <el-table-column     prop="resolver" align="center" label="解决人">
            <template #default="scope">
                <span 
                    v-text="scope.row.resolver_label"></span>
            </template>
        </el-table-column>
        	<!--status select -->
        <el-table-column     prop="status" align="center" label="状态">
            <template #default="scope">
                <span :class="$js.page.colorful(scope.row.status,'status')" 
                    v-text="scope.row.status_label"></span>
            </template>
        </el-table-column>
        	<!--create_time date -->
        <el-table-column  show-overflow-tooltip    align="center" label="创建时间" >
            <template #default="scope">
                  <span>{{ scope.row.create_time||'-' }}</span>
              </template>
        </el-table-column>

<el-table-column fixed="right" align="center" label="操作" width="168">
    <template #default="scope">
        <div class="opts">
            <el-button   type="text" @click="show_cmpnt_aaaof(scope.row)" >详情 </el-button>
            <el-button   type="text" @click="show_cmpnt_aaaoe(scope.row)" >修改 </el-button>
            <el-button   type="text" @click="show_cmpnt_aaaog(scope.row)" >删除 </el-button>
        </div>
    </template>
</el-table-column>
    </el-table>
    <el-pagination :currentPage="form_aaaod.pi" :page-size="form_aaaod.ps"
        style="position: absolute; right: 30px;bottom:6px;" :page-sizes="[10,15,20,30, 50, 100]" :background="false" small
        layout="total,sizes,prev, pager, next, jumper" :total="total_aaaod" @size-change="handleSizeChange"
        @current-change="handleCurrentChange" />
</div>
  </div>
</template>
<script>
// 添加问题收集
import aaaoh from "@/views/ws/prod/prod_problem.add"
// 详情
import aaaof from "@/views/ws/prod/prod_problem.view"
// 修改
import aaaoe from "@/views/ws/prod/prod_problem.edit"
// 已解决
import aaaoi from "@/views/ws/prod/prod_problem.dialog"
// 完成
import aaaoj from "@/views/ws/prod/prod_problem.cnfrm"
// 删除
import aaaog from "@/views/ws/prod/prod_problem.cnfrm"
// 业务线
import ddmenu from "@/views/cmpnts/ddMenu.vue"



export default {
components: {
    aaaoh,
    aaaof,
    aaaoe,
    aaaoi,
    aaaoj,
    aaaog,
     ddmenu,
},
data() {
  return {
    shortcuts: this.$js.page.latestDays(),
    cmpnt_funcs:{},
    bcheck:[],
    conf: {
      loading: false,
      progressColor: this.$theia.env.conf.progress || []
    },
    ganttIdx: -1,
        form_aaaod: {
            pi: 1,
            ps: 15,
            disabled:false,
            single_date_range_name:"",
            single_date_range_value:[],
            single_text_name:"",
            single_text_value:"",
            title:"",
            prod_id:[],
            problem_category:[],
            description:"",
            status:"",
            create_time:"",
            lob_id:"",
            },
            prod_idExts:[],
            prod_idList:[],
            problem_categoryList:[],
            resolverExts:[],
            resolverList:[],
            statusList:[],
            creatorList:[],
            lob_idList:[],
            dataList_aaaod:[],
            multiQueryDateRange:[{label:"创建时间",value:"create_time"},],
            multiQueryText:[{label:"标题",value:"title"},{label:"问题说明",value:"description"},],
            total_aaaod:0,
            note_dataList:[],
};
  },
mounted() {
  this.loadEnums_aaaod()
  this.form_aaaod.lob_id = this.$theia.user.get("lob_id")
  this.form_aaaod.single_date_range_name = (this.multiQueryDateRange[0]||{}).value
  this.form_aaaod.single_text_name = (this.multiQueryText[0]||{}).value
  this.cmpnt_funcs["aaaoh"] = this.show_cmpnt_aaaoh
  this.cmpnt_funcs["aaaof"] = this.show_cmpnt_aaaof
  this.cmpnt_funcs["aaaoe"] = this.show_cmpnt_aaaoe
  this.cmpnt_funcs["aaaoi"] = this.show_cmpnt_aaaoi
  this.cmpnt_funcs["aaaoj"] = this.show_cmpnt_aaaoj
  this.cmpnt_funcs["aaaog"] = this.show_cmpnt_aaaog

  this.form_aaaod = Object.assign(this.form_aaaod,this.$route.params)
  this.queryData_aaaod ()
    },
methods: {
  ganttChange(id) {
      this.ganttIdx = id
    },

queryData_aaaod(mform = {},nform={}){
    //构建查询参数
    let queryForm = Object.assign({},this.form_aaaod)
    queryForm = Object.assign(queryForm,nform||{})
    
    //处理多个日期选择
    queryForm[this.form_aaaod.single_date_range_name] = this.form_aaaod.single_date_range_value
    queryForm[this.form_aaaod.single_text_name] = this.form_aaaod.single_text_value
   
    //处理日期范围选择
      queryForm.prod_id = (queryForm.prod_id||[]).join(",")
      queryForm.problem_category = (queryForm.problem_category||[]).join(",")
      queryForm.start_create_time = null
      queryForm.end_create_time = null
    if(queryForm.create_time && queryForm.create_time.length > 1){
      queryForm.start_create_time = queryForm.create_time[0]
      queryForm.end_create_time = queryForm.create_time[1]
    }

    queryForm[this.form_aaaod.single_date_range_name] = null
    queryForm.single_date_range_value = null
    queryForm.single_date_range_name = null

    queryForm.single_text_value = null
    queryForm.single_text_name = null
 
    //处理关联表prod_problem prod_problem 
   
    //发送查询请求
    let that = this
    that.conf.loading = true
    //构建统计查询
  //数据查询
  this.$theia.http.get("/ws/prod/problem/query",queryForm).then(res=>{
      if((res.items||[]).length < (queryForm.ps||10)){
        that.form_aaaod.disabled = true
      }
      that.conf.loading = false
      that.dataList_aaaod = res.items||[]
      that.total_aaaod = res.count
      that.resetItemData_aaaod(that,that.dataList_aaaod)
    });
  },

  resetItemData_aaaod(that,lst){
    lst.forEach(item => {
      item.__raw = Object.assign({}, item)
    item.prod_id_label = that.$theia.enum.getName("feedback_prod_req",item.prod_id)
    item.problem_category_label = that.$theia.enum.getName("prod_problem_category",item.problem_category)
    item.resolver_label = that.$theia.enum.getName("staff_info",item.resolver)
    item.status_label = that.$theia.enum.getName("prod_problem",item.status)
    item.creator_label = that.$theia.enum.getName("user_account",item.creator)
    item.lob_id_label = that.$theia.enum.getName("my_business_line",item.lob_id)
    item.id_progress = item.id
    item.title_progress = item.title
    item.prod_id_progress = item.prod_id
    item.problem_category_progress = item.problem_category
    item.description_progress = item.description
    item.description_urls_progress = item.description_urls
    item.solution_progress = item.solution
    item.resolver_progress = item.resolver
    item.status_progress = item.status
    item.creator_progress = item.creator
    item.create_time_progress = item.create_time
    item.lob_id_progress = item.lob_id
    item.le_id = item.id
    item.le_title = item.title
    item.le_prod_id = item.prod_id
    item.le_problem_category = item.problem_category
    item.le_description = item.description
    item.le_description_urls = item.description_urls
    item.le_solution = item.solution
    item.le_resolver = item.resolver
    item.le_status = item.status
    item.le_creator = item.creator
    item.le_create_time = that.$theia.str.dateFormat(item.create_time,'MM/dd')
    item.le_lob_id = item.lob_id
    item.create_time = that.$theia.str.dateFormat(item.create_time,'MM/dd')
    if(item.children){
      that.resetItemData_aaaod(that,item.children)
    }
  });
  },
    handleSelectionChange(lst=[]){
      this.bcheck = []
      lst.forEach(f=>{
        this.bcheck.push(f.id)
      })
    },
    loadEnums_aaaod(){
        //需求
        this.prod_idList = this.$theia.enum.get("feedback_prod_req","",this.$theia.user.get("lob_id"),false,"/ws/prod/requirement/feedback")
        //问题分类
        this.problem_categoryList = this.$theia.enum.get("prod_problem_category","","" ,false,"")
        //状态
        this.statusList = this.$theia.enum.get("prod_problem","","" ,false,"")
        //业务线
        this.lob_idList = this.$theia.enum.getTree("my_business_line","","" ,99)
        //需求
        this.prod_idList = this.$theia.enum.get("feedback_prod_req","",this.$theia.user.get("lob_id"),false,"/ws/prod/requirement/feedback")
        //问题分类
        this.problem_categoryList = this.$theia.enum.get("prod_problem_category","","" ,false,"")
        //解决人
        this.resolverList = this.$theia.enum.get("staff_info","",this.$theia.user.get("lob_id"),false,"")
        //状态
        this.statusList = this.$theia.enum.get("prod_problem","","" ,false,"")
    },

  handleSizeChange(ps){
    this.form_aaaod.ps = ps
    this.onQuery(true)
  },
  onlob_idChange(v){
    this.$theia.user.set("lob_id",v)
    this.loadEnums_aaaod()
    this.onQuery(true)
  },
  handleCurrentChange(pi){
    this.form_aaaod.pi = pi
    this.onQuery()
  },
  onQuery(refresh){
    if(refresh){
      this.form_aaaod.pi = 1
    }
    this.queryData_aaaod ()
  },
show_cmpnt(cmd,row){
  if(this.cmpnt_funcs[cmd]){
    this.cmpnt_funcs[cmd](row)
  }
},
  //详情
  show_cmpnt_aaaof(fm = {}){
    let query = {} 
    query.id = fm.id|| fm.le_id 
    query.title = fm.title|| fm.le_title 
    query.prod_id = fm.prod_id|| fm.le_prod_id 
    query.problem_category = fm.problem_category|| fm.le_problem_category 
    query.description = fm.description|| fm.le_description 
    query.description_urls = fm.description_urls|| fm.le_description_urls 
    query.solution = fm.solution|| fm.le_solution 
    query.resolver = fm.resolver|| fm.le_resolver 
    query.status = fm.status|| fm.le_status 
    query.creator = fm.creator|| fm.le_creator 
    query.create_time = fm.create_time|| fm.le_create_time 
    query.lob_id = fm.lob_id|| fm.le_lob_id 
    query.id = fm.id

      //2023.4.18添加---

    query.$title="详情"
    this.$refs.cmpnt_aaaof.show(query)
  },
  //添加问题收集
  show_cmpnt_aaaoh(fm = {}){
    let query = {} 
    query.title = fm.title|| fm.le_title 
    query.prod_id = fm.prod_id|| fm.le_prod_id 
    query.problem_category = fm.problem_category|| fm.le_problem_category 
    query.description = fm.description|| fm.le_description 
    query.id = fm.id

      //2023.4.18添加---
    query.status = "10"

    query.$title="添加问题收集"
    this.$refs.cmpnt_aaaoh.show(query)
  },
  //修改
  show_cmpnt_aaaoe(fm = {}){
    let query = {} 
    query.title = fm.title|| fm.le_title 
    query.prod_id = fm.prod_id|| fm.le_prod_id 
    query.problem_category = fm.problem_category|| fm.le_problem_category 
    query.description = fm.description|| fm.le_description 
    query.id = fm.id

      //2023.4.18添加---

    query.$title="修改"
    this.$refs.cmpnt_aaaoe.show(query)
  },
  //删除
  show_cmpnt_aaaog(fm = {}){
    let query = {} 
    query.id = fm.id|| fm.le_id 
    query.id = fm.id

      //2023.4.18添加---

    query.$title="删除"
    this.$refs.cmpnt_aaaog.show_aaaog(query)
  },
  //已解决
  show_cmpnt_aaaoi(fm = {}){
    let query = {}
    query.m = fm.sr|| fm.le_sr 
    query.id = fm.id

      //2023.4.18添加---
    query.id = (this.bcheck||[]).join(",")
    query.status = "20"

    query.$title="已解决"
    this.$refs.cmpnt_aaaoi.show_aaaoi(query)
  },
  //完成
  show_cmpnt_aaaoj(fm = {}){
    let query = {}
    query.m = fm.mmm|| fm.le_mmm 
    query.id = fm.id

      //2023.4.18添加---
    query.id = (this.bcheck||[]).join(",")
    query.status = "0"

    query.$title="完成"
    this.$refs.cmpnt_aaaoj.show_aaaoj(query)
  },
},
};
</script>
<style>
.el-dialog{
  border-radius:5px !important
}
</style>
<style scoped>
.el-form-item {
  margin-right: 10px !important;
}

.opts .el-button--small {
  margin-left: 0px;
  padding-left: 0px;
  margin-right: 4px;
}

/deep/.el-table td.el-table__cell div {
  vertical-align: middle;
}
/deep/.el-button+.el-dropdown{
  margin-left:0px;
}
/deep/.el-button+.el-button{
  margin-left:0px;
}
.el-button{
  padding-left: 6px !important;
  padding-right: 6px !important;
}
.blist {
  margin-bottom: 8px;
  width: 100%;
}

.blist .el-radio-group {
  margin-right: 8px;
}

.ddl {
  margin-bottom: 8px;
  width: 100%;

}

.ddl .el-dropdown {
  margin-right: 8px;
}

.listbar {
  margin-bottom: 8px;
  text-align: center;
}
 .el-dropdown-link {
  cursor: pointer;
  color: var(--el-color-primary);
  display: flex;
  align-items: center;
  font-size: 0.65rem;
}
/deep/.el-button--small{
  padding: 5px 4px;
}

.prepend /deep/.el-input__wrapper{
  border-top-right-radius:0;
  border-bottom-right-radius:0;
}
.prepend+/deep/.el-date-editor{
  border-top-left-radius:0;
  border-bottom-left-radius:0;
  border-left:0;
}

</style>